package C11_11_ReplaceInheritanceWithDelegation.refactorafter;

import java.util.Vector;

/**
 * @ClassName : MyStack
 * @Description : 以委托取代继承
 * @Author : wukj1
 * @Date: 2022/8/16
 **/
public class MyStack{

    private Vector vector = new Vector();

    public boolean remove(Object o) {
        return vector.removeElement(o);
    }

    public void add(int index, Object element) {
        vector.insertElementAt(element, index);
    }

    public synchronized int size() {
        return vector.size();
    }

    public synchronized boolean isEmpty() {
        return vector.isEmpty();
    }
}
